//Given absolute tileY's, and tileX's check for overlap
var bottom = argument0;
var top = argument1;
///var buffer = instance_create(0, 0, obj_Module);
var buffer = 0;
var tileX = min(top.tileX, bottom.tileX);
var tileY = min(top.tileY, bottom.tileY);
///buffer.tileX = min(top.tileX, bottom.tileX); 
///buffer.tileY = min(top.tileY, bottom.tileY);

var bottomOffsetX = bottom.tileX - tileX;
var bottomOffsetY = bottom.tileY - tileY;
///var bottomOffsetX = bottom.tileX - buffer.tileX;
///var bottomOffsetY = bottom.tileY - buffer.tileY;

var topOffsetX = top.tileX - tileX;
var topOffsetY = top.tileY - tileY;
///var topOffsetX = top.tileX - buffer.tileX;
///var topOffsetY = top.tileY - buffer.tileY;

var bufferWidth = max(bottomOffsetX + array_length_2d(bottom.tiles, 0), topOffsetX + array_length_2d(top.tiles, 0)) 
var bufferHeight = max(bottomOffsetY + array_height_2d(bottom.tiles), topOffsetY + array_height_2d(top.tiles));

for(var yyy = 0; yyy < bufferHeight; yyy++)
{
    for(var xxx = 0; xxx < bufferWidth; xxx++)
    {
        buffer[yyy, xxx] = 0;
        ///buffer.tiles[yyy, xxx] = 0;
    }
}

//Add bottom layer
for(var yyy = 0; yyy < array_height_2d(bottom.tiles); yyy++)
{
    for(var xxx = 0; xxx < array_length_2d(bottom.tiles, yyy); xxx++)
    {
        if(bottom.tiles[yyy, xxx] != 0)
        {
            ///var tile = 0;
            ///tile = instance_create(0, 0, obj_Tile);
            ///setTile(xxx + bottomOffsetX, yyy + bottomOffsetY, tile, buffer);
            buffer[yyy + bottomOffsetY, xxx + bottomOffsetX] = 1;
        }
    }
}

//Add top layer
for(var yyy = 0; yyy < array_height_2d(top.tiles); yyy++)
{
    for(var xxx = 0; xxx < array_length_2d(top.tiles, yyy); xxx++)
    {
        if(top.tiles[yyy, xxx] != 0 && buffer[yyy + topOffsetY, xxx + topOffsetX] != 0 )
        ///if(top.tiles[yyy, xxx] != 0 && buffer.tiles[yyy + topOffsetY, xxx + topOffsetX] != 0 )
        {
            /*with(buffer)
            {
                instance_destroy();
            }*/
            return true;
        }
    }
}
/* with(buffer)
{
    instance_destroy();
}*/
return false;